<template>
	<view>
		<view class='sign-record'>
		   <view class='list' style="padding: 0 30rpx">
		      <view class='item'>
		         <view class='listn'>
		            <view class='itemn acea-row row-between-wrapper' v-for="(itemn,indexn) in signList" :key="indexn">
		               <view>
		                  <view class='name line1'>{{itemn.title}}</view>
		                  <view>{{itemn.updateTime}}</view>
		               </view>
		               <view v-if="itemn.type == 1" class='num font-color'>+{{itemn.integral}}</view>
                   <view v-if="itemn.type == 2" class='num font-color-red'>-{{itemn.integral}}</view>
		            </view>
		         </view>
		      </view>
		   </view>
		    <view class='loadingicon acea-row row-center-wrapper' style="color:#999;margin-top: 20rpx;font-size: 24rpx;">
		        <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadtitle}}
		     </view>
		</view>
	</view>
</template>

<script>
	import { getIntegralList } from '@/api/api';
	export default {
		data() {
			return {
				loading:false,
				    loadend:false,
				    loadtitle:'加载更多',
				    page:1,
				    limit:20,
				    signList:[],
					isAuto: false, //没有授权的不会自动授权
					isShowAuth: false //是否隐藏授权
			};
		},
		onLoad(){
      this.getList();
			
		},
		onReachBottom: function () {
      this.page++
		    this.getList();
		  },
		methods: {
			  /**
			     * 获取签到记录列表
			    */
			    getList:function(){
			      let that=this;
			      if(that.loading) return;
			      if(that.loadend) return;
            that.loading = true;
            that.loadtitle = "";
			      getIntegralList({ page: that.page, limit: that.limit }).then(res=>{
			        let list = res.list;
			        let loadend = list.length < that.limit;
			        that.signList = that.signList.concat(list)
              that.$set(that,'signList',that.signList);
              that.loadend = loadend;
              that.loading = false;
              that.loadtitle = loadend ? "到底啦，没有数据了~" : "加载更多"
                }).catch(err=>{
              that.loading = false;
              that.loadtitle = '加载更多';
			      });
			    },
		}
	}
</script>

<style>
  
.sign-record .list .item .data{height:80rpx;line-height:80rpx;font-size:24rpx;color:#666;}
.sign-record .list .item .listn{ font-size:24rpx;color:#999;background-color: #fff;border-radius: 14rpx;}
.sign-record .list .item .listn .itemn{height: 120rpx;
  border-bottom: 1rpx solid #eee;
  padding: 0 24rpx;}
.sign-record .list .item .listn .itemn .name{width:390rpx;font-size:28rpx;color:#282828;margin-bottom:10rpx;}
.sign-record .list .item .listn .itemn .num{font-size:36rpx;font-family: 'Guildford Pro';color:#16ac57;}
.font-color-red {color: #FF774D!important}
</style>
